UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lUwNAJ/x9TaG6hodbLo3V+95dQ71wX2e2Qzep31ukhE='
WHERE
key_id = 'c71f88a8085397ab083ad2012ba71ac6a5a17315da840b0388cc56d96d9eee84'
AND (
token = 'lUwNAJ/x9TaG6hodbLo3V+95dQ71wX2e2Qzep31ukhE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)