UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ydQCa9P8NkSt+lY6drqg/8tdB/fXHbZDR4gyLwMNYWY='
WHERE
key_id = 'd0c998c74da43aa79577644bed6f32bac0bc2dfc33efe54dac4a49ab6a06aa44'
AND (
token = 'ydQCa9P8NkSt+lY6drqg/8tdB/fXHbZDR4gyLwMNYWY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)