UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8fV5SIgCDKHC5KPbNxK1zOde83uSmVA2oRSuX+f3mHc='
WHERE
key_id = '7a9908168261f5712046af04d209013dd132e2261e7b037d3678d8089c1971e2'
AND (
token = '8fV5SIgCDKHC5KPbNxK1zOde83uSmVA2oRSuX+f3mHc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)