UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tANt4eA4Sot4T4sVRHA1sBqA4HXhebSWhW+RUa5kzws=' 
WHERE 
  key_id = 'a53d8f35b4b385d0f8611e3cac6f3927dbbd6db037b5c3948e5702cfa3165305' 
  AND (
    token = 'tANt4eA4Sot4T4sVRHA1sBqA4HXhebSWhW+RUa5kzws=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00058