UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qW8crAlS0uPrdIZozBHU1sBSdxnxLGow2RcYM/EAh8o='
WHERE
key_id = 'b779f5783b54795638b8c7b68660d7b9635f4f1a6d3c26847cdf209aea744ab4'
AND (
token = 'qW8crAlS0uPrdIZozBHU1sBSdxnxLGow2RcYM/EAh8o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)