UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'k9AJ+C6NgUr8aetzd2s9bg5vEOv8rCIVpH+KKlGsqd4='
WHERE
key_id = 'a111fe7b00f77d22a4b1b9f643392124101f98b90d746e6df6e92c38bb4e60a5'
AND (
token = 'k9AJ+C6NgUr8aetzd2s9bg5vEOv8rCIVpH+KKlGsqd4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)