UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'fgQxt/vWngk3aj4pC5UhSmVbv+efTrCGQEoktbxzMUs='
WHERE
key_id = '31c700b707a321a24d822da63ccc6e7dff547a3cc90878891417be388d72fe2f'
AND (
token = 'fgQxt/vWngk3aj4pC5UhSmVbv+efTrCGQEoktbxzMUs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)