UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ur7m0g0XyM17+92T8Z4EIx7FtgPdISwa0zITLf5iDfQ=' 
WHERE 
  key_id = '18e1d47645f27258c2dcf7614daf6dbaa41b225538e6c2c5d34099210bd1b2cb' 
  AND (
    token = 'Ur7m0g0XyM17+92T8Z4EIx7FtgPdISwa0zITLf5iDfQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023