UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vP7D/PKgrjr/4sPsxz70Y3KTpq7wpT5eUvIXqNYtXQE=' 
WHERE 
  key_id = '3d7622185ba084548e2e99f7a8aff1243a781f4458447ecfe032c36db433f680' 
  AND (
    token = 'vP7D/PKgrjr/4sPsxz70Y3KTpq7wpT5eUvIXqNYtXQE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032