UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9ZhZAUKKgFuXZD6LTijc1iD7D8NUgCAU8R/wyTMKxVI='
WHERE
key_id = '8b578fe1d3d24730a5eddd2df71020f3ae9daadef16032b0331e86f40172fc68'
AND (
token = '9ZhZAUKKgFuXZD6LTijc1iD7D8NUgCAU8R/wyTMKxVI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)