UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6CqdnS2J7rRiVC0qW1VDMUoLIRDMGKHVbGpnqO8M9ns='
WHERE
key_id = '49e5edc20ab4fa4a8bd357937bdab86655cd8c21e246ee619227b8de4bd9fac6'
AND (
token = '6CqdnS2J7rRiVC0qW1VDMUoLIRDMGKHVbGpnqO8M9ns='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)