UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oFRyKW0g6neg0Azx5HvtplxktDfXn46ZG1tkxF75K1k=' 
WHERE 
  key_id = '274a619d6a9fdba62f062adc170c07630da71289dba00b57ca7976b5ffbf881d' 
  AND (
    token = 'oFRyKW0g6neg0Azx5HvtplxktDfXn46ZG1tkxF75K1k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045