UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'q2g3A3EY4Rgw0sJ+m3JKMFyr3a2DS3IbSoQ+oolIBcU='
WHERE
key_id = '831839d5ce8284d35654cc1a06bb54c6ce32778bd04788da284334b6a1abda2f'
AND (
token = 'q2g3A3EY4Rgw0sJ+m3JKMFyr3a2DS3IbSoQ+oolIBcU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)