UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KKmtyBCAc7uv4yO/w2rp3tVN8E0gSTr6Qkmaha7ofJI='
WHERE
key_id = '3a4ffe11834a98e576c38b35b2014f0a1b52ca23c691f5a5efb390cac6f5ef53'
AND (
token = 'KKmtyBCAc7uv4yO/w2rp3tVN8E0gSTr6Qkmaha7ofJI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)