UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'y8KQRZFaOeZSHtFef6cUGGtaTpNWfroH3IW91EKtufM='
WHERE
key_id = '16d61886f10911b3e97d26ed3e2d2541cafdb7c8c31692bb98992080d6e246f0'
AND (
token = 'y8KQRZFaOeZSHtFef6cUGGtaTpNWfroH3IW91EKtufM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)