UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'beNlTnbFTCUW6ZYgx1Sa7kzDgYFpzQfQDnpy67vqA1Q='
WHERE
key_id = 'fa084e228c7d3c9039cda2cf328985757e3fa9c1434fce1946b1ffb2e2446456'
AND (
token = 'beNlTnbFTCUW6ZYgx1Sa7kzDgYFpzQfQDnpy67vqA1Q='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)