UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'SXr5FA520wQ2SsdB4KuOgSKtYaogjxuSmFd3qw7qyNA='
WHERE
key_id = 'c3760d536b4b6cbb6dd7b2798e9a223f50ce2b579fb2ce8673a58aa78a3c784f'
AND (
token = 'SXr5FA520wQ2SsdB4KuOgSKtYaogjxuSmFd3qw7qyNA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)