UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KgBECN206apSgCsoL78StYfdfg5b18aTkOs+Jc+bpG4='
WHERE
key_id = '906c8e3b4600521cd9a5aa160c4b68fd8828b5481f76e9eb3ccabc014ee6d169'
AND (
token = 'KgBECN206apSgCsoL78StYfdfg5b18aTkOs+Jc+bpG4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)