UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'HXHcXM8h+oN1TSxMDPonRWmI8AnSsovvIv+bns/06nk='
WHERE
key_id = '240ad4a245c985294519a94585ccdf8ee1f0b2da7ae9c0d7492c4be3de646275'
AND (
token = 'HXHcXM8h+oN1TSxMDPonRWmI8AnSsovvIv+bns/06nk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)