UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '99IPGYWJpkXP3ktEGXA7bszo0TapP1nzhNCPsDCNWeM=' 
WHERE 
  key_id = 'bf121fdba61347eaa0c3bf2e8151575ec5ab1cbf6e009cedeef23e1ff16515d9' 
  AND (
    token = '99IPGYWJpkXP3ktEGXA7bszo0TapP1nzhNCPsDCNWeM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026