UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'f6SQT9MC+Uj9f2MD5Uq3cQvs27eDz+DdSBXXXFndKcw='
WHERE
key_id = '326beb8cf75608a8ffbbc9ae06a4f50721fce4383d20ccc240f594052bfc855f'
AND (
token = 'f6SQT9MC+Uj9f2MD5Uq3cQvs27eDz+DdSBXXXFndKcw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)