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