UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IPZDXZME3rHwwp2CKGH0oGQUCRMRwquusVM2+adxeBs=' 
WHERE 
  key_id = '0d6b28a7cb4dc4f766d7fb280bf4d15a237843867a43bc67f112d94343f59f90' 
  AND (
    token = 'IPZDXZME3rHwwp2CKGH0oGQUCRMRwquusVM2+adxeBs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023