UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'SJuqCsXQbIqQsq74VfGWZYIiwJaCF915zmDS9Js/+R8='
WHERE
key_id = 'f0718b96e9576c26e3fadb53673d3a8e40f77c9ce794f5327300c027c5048d49'
AND (
token = 'SJuqCsXQbIqQsq74VfGWZYIiwJaCF915zmDS9Js/+R8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)