UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'G4r/UwHjqXyeO2JK3ENZLP8naH5ioqPPVhwiXnLtirc=' 
WHERE 
  key_id = 'd728ac574719b86049335aae94642e17046441e6a9de1b08bef99cd4213b9280' 
  AND (
    token = 'G4r/UwHjqXyeO2JK3ENZLP8naH5ioqPPVhwiXnLtirc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023