UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LBYEpSP9ePAAR/NxeomckMiS4Z2fXJLzODk7wDibrfI=' 
WHERE 
  key_id = '87fd1060c72f41aae8de32f6e7608756f4e4397d4ead3f9c93cf6be4bb6d227f' 
  AND (
    token = 'LBYEpSP9ePAAR/NxeomckMiS4Z2fXJLzODk7wDibrfI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024