UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hQjz7dwu3XF5QecnFQTkSNLuGSyppQjM9aSdDzcm550='
WHERE
key_id = '9b724ef6393e22ba755eceef5c0b08e8630aa513e05b3e374541f66a63eb8f2a'
AND (
token = 'hQjz7dwu3XF5QecnFQTkSNLuGSyppQjM9aSdDzcm550='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)