UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6dm2laVb5jAFQP5vQWKjSDZ9Hanlr/PdHQltKe2YiIE='
WHERE
key_id = '1ba3f70414df457da60eb746f08db73d55701f18d165b7974415f9023c8515ae'
AND (
token = '6dm2laVb5jAFQP5vQWKjSDZ9Hanlr/PdHQltKe2YiIE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)