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