UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0mkKrx7xrqAPcunNgJBwBGO7epW6MvwXhT3wJIQt3ms='
WHERE
key_id = '100da10386ec292f5bec526cdc1da3ab799feb5cd94ba636555d1bca57d9573e'
AND (
token = '0mkKrx7xrqAPcunNgJBwBGO7epW6MvwXhT3wJIQt3ms='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)