UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TiZ26dba2A/gwOYcotbLdVy7v8j8CxV5PhETN0LAA5E='
WHERE
key_id = 'dc64e0d62afd4c565111d1bb7a77bef2699cbad3e729b834940fbb985b7fd127'
AND (
token = 'TiZ26dba2A/gwOYcotbLdVy7v8j8CxV5PhETN0LAA5E='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)