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