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