UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7g3LYYlyucj6tL5jnsApAm4TdUYyahQnJNwNKPPMreg=' 
WHERE 
  key_id = 'd857f9e1ff1d932da21a5d392c10bb90bb3069af4914bd719c341e1fef510d0a' 
  AND (
    token = '7g3LYYlyucj6tL5jnsApAm4TdUYyahQnJNwNKPPMreg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030