UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VwzNXtOzEWUnWBDbUfmZh8XxaX9OOu1T/eXrzYg1VNQ=' 
WHERE 
  key_id = '252a539a1b6087856f1c4645e54a5123a42484164c9196b5decd7eeb7c801706' 
  AND (
    token = 'VwzNXtOzEWUnWBDbUfmZh8XxaX9OOu1T/eXrzYg1VNQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029