UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QRbJjULRm3uKIfSnjTcW5F4KLhpChQd82/bYwZ+Lm7U='
WHERE
key_id = 'b98a65acd3173b33b23fb0c0ab0a4a66f224f03aae7074be70e96d29915a77b7'
AND (
token = 'QRbJjULRm3uKIfSnjTcW5F4KLhpChQd82/bYwZ+Lm7U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)