UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OdvAKp58lJnn9/JxZ3XlmzMTG9Zk5eRMWeFZFKjSAeg=' 
WHERE 
  key_id = '8c49f689a12d97e0fedcc23f05b8f919eeca979f6595d38181881668a142216d' 
  AND (
    token = 'OdvAKp58lJnn9/JxZ3XlmzMTG9Zk5eRMWeFZFKjSAeg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022