UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KedoKcFvKawZCcdnMGXQglppBqCA2UNZNPTsHZLHYeo='
WHERE
key_id = '8b7c40a5678112f5c2ee2e6cbf39d2639be7d65d371a38f38584609d9d5d63f6'
AND (
token = 'KedoKcFvKawZCcdnMGXQglppBqCA2UNZNPTsHZLHYeo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)