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

Query time 0.00056