UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wJG/tHZUj8BtfysDN6XXgsXgm4THwnA2EPzi1FeEYSw=' 
WHERE 
  key_id = '314b2f4eded8e4ac5a5681399233e1052c49878ac630017b3d0362e875c4e269' 
  AND (
    token = 'wJG/tHZUj8BtfysDN6XXgsXgm4THwnA2EPzi1FeEYSw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035