UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TS1qpbwAcp8xpAZxPHxWGsn23tTGUdLy+q4gCniF9Mk='
WHERE
key_id = '6d42b7544a3ed9895e47a1f8ebac784a0d4d90b200bb69ec2e693c21e32cc677'
AND (
token = 'TS1qpbwAcp8xpAZxPHxWGsn23tTGUdLy+q4gCniF9Mk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)