UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WDSYtgjUH+RN9KDIE23CZrmK7Z4uEGNMYMuMmJBg9pI=' 
WHERE 
  key_id = '5727816e07ba3600992c041f47e70b22f4c2fbf42330cc05635d20397a377fc0' 
  AND (
    token = 'WDSYtgjUH+RN9KDIE23CZrmK7Z4uEGNMYMuMmJBg9pI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00015