UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0iPTJv5k9tpamQ3Ve5YEukRSdFUETDNgjPWo82Ueeh4='
WHERE
key_id = 'a6df0c036c6f3e2c517d7880adc5ff2cb6b9a61cca94dde3a6ba49121fef2589'
AND (
token = '0iPTJv5k9tpamQ3Ve5YEukRSdFUETDNgjPWo82Ueeh4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)