UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'T2baWauked1CI78kXTXzJY0fS3hY8YNVRaRTOkmggm8=' 
WHERE 
  key_id = 'd262abd438c403dc203c0eb30706707c5d0710e522a763ceaad142c53b34137f' 
  AND (
    token = 'T2baWauked1CI78kXTXzJY0fS3hY8YNVRaRTOkmggm8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018