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