UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9+5D/SZN2uDe601fZz0RrZm1rNz7HBkYmMnCp1sWaNo=' 
WHERE 
  key_id = '56fe710e191c8d3a46c29362377552ebf830456596008eb06bc3232d992b7f6d' 
  AND (
    token = '9+5D/SZN2uDe601fZz0RrZm1rNz7HBkYmMnCp1sWaNo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016