UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YChZ36kLMc5T+Z7W2GfC/dTT+sZxTN+vC3xfxKna69I=' 
WHERE 
  key_id = '2949382a307a58c2a85e3245aed9dfbd2e8dc52d69c5c4dea7fe102aa0168283' 
  AND (
    token = 'YChZ36kLMc5T+Z7W2GfC/dTT+sZxTN+vC3xfxKna69I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023