UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'g/Xp0TchOGI2TXaiakYdbAIOlRYuXHVSTgZdSQHGP5w=' 
WHERE 
  key_id = '164db314a280ab87c56ff25a950d3dc5050bebb7d8367f2823ec0da6ed46c809' 
  AND (
    token = 'g/Xp0TchOGI2TXaiakYdbAIOlRYuXHVSTgZdSQHGP5w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044