UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'od0On/cry7uae6Nel/XyG1PhzB0/23uN5cKK+CGkqbs=' 
WHERE 
  key_id = 'a72f1d2add119d584a242de911cf0ec34c024fd6b681ec8d023a31a407769d84' 
  AND (
    token = 'od0On/cry7uae6Nel/XyG1PhzB0/23uN5cKK+CGkqbs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00077