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