UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'waPwkhOrlKDPXkW4pd3WIodfF4RMiq8a+ate30hDkOY=' 
WHERE 
  key_id = 'b4cf10ee6715fe124c9dd2495d7283b3db95e1cb3cc0cfba61679a5b74603831' 
  AND (
    token = 'waPwkhOrlKDPXkW4pd3WIodfF4RMiq8a+ate30hDkOY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026