UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'HGjusViZybqJF/V+ZkauBxvuJgDvy3nxX2miY2AYEnk='
WHERE
key_id = 'fe3297f0150ed57e272703d543f88e5c513562b2bc5abcfbf59367e472ad1398'
AND (
token = 'HGjusViZybqJF/V+ZkauBxvuJgDvy3nxX2miY2AYEnk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)