UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nYzaVA2rgbQ4CdBF4mrCPYf6MEmY6s1c4lmYh6Uy4Lo='
WHERE
key_id = '9cb60630d7f843b5df99a4b08e0389891983964dbb07135ace1c91dc5f2adade'
AND (
token = 'nYzaVA2rgbQ4CdBF4mrCPYf6MEmY6s1c4lmYh6Uy4Lo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)